<template>
	<view class="protocol_box">
		<view class="select" :class="{active: agree}" @click="agreeClick"></view>
		我已同意
		<text v-if="protocolArr.length > 0" @click="protocolClick(0)">{{protocolArr[0]}}</text>
		&ensp;<span v-if="protocolArr.length > 1">{{" 和 "}}</span>&ensp;
		<text v-if="protocolArr.length > 1" @click="protocolClick(1)">{{protocolArr[1]}}</text>
	</view>
</template>

<script>
	export default {
		props: {
             // 是否同意
			agree: {
				type: Boolean,
				default: false
			},
			// 协议数组
			protocolArr: {
				type: Array,
				default:function() {
					return [];
				}
			},

		},

		methods: {
		    // 是否同意勾选
			agreeClick() {

				this.$emit('click')

			},
			protocolClick(tag){
				
				this.$emit('protocolClick',tag)
				
			}

		}


	}
</script>




<style lang="scss" scoped>
	//主题色 #ea552d
	$themeColor: #2796f2;

	.protocol_box {
		margin-top: 40rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		font-size: 28rpx;
		color: #333333;
		margin-bottom: 40rpx;
		.select {
			width: 36rpx;
			height: 36rpx;
			background-image: url("./ic_nor.png");
			background-position: center center;
			background-repeat: no-repeat;
			background-size: 100% auto;
			margin-right: 15rpx;

			&.active {
				background-image: url("./ic_sel.png");
			}
		}

		>text {
			color: $themeColor;
		}
	}
</style>